<!--
 * @Author: tianhao
 * @Date: 2023-01-07 19:37:46
 * @LastEditTime: 2023-02-21 19:37:27
 * @LastEditors: tianhao
 * @Description: 
 * @FilePath: \dcollege\src\views\task\search.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
  <div class="top">
    <var-icon name="chevron-left" :size="30" class="ret" @click="fanHui()" />
    <div class="sch">
      <svg
        t="1672721018422"
        class="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="2693"
        width="25"
        height="25"
      >
        <path
          d="M862.609 816.955L726.44 680.785l-0.059-0.056a358.907 358.907 0 0 0 56.43-91.927c18.824-44.507 28.369-91.767 28.369-140.467 0-48.701-9.545-95.96-28.369-140.467-18.176-42.973-44.19-81.56-77.319-114.689-33.13-33.129-71.717-59.144-114.69-77.32-44.507-18.825-91.767-28.37-140.467-28.37-48.701 0-95.96 9.545-140.467 28.37-42.973 18.176-81.56 44.19-114.689 77.32-33.13 33.129-59.144 71.717-77.32 114.689-18.825 44.507-28.37 91.767-28.37 140.467 0 48.7 9.545 95.96 28.37 140.467 18.176 42.974 44.19 81.561 77.32 114.69 33.129 33.129 71.717 59.144 114.689 77.319 44.507 18.824 91.767 28.369 140.467 28.369 48.7 0 95.96-9.545 140.467-28.369 32.78-13.864 62.997-32.303 90.197-54.968 0.063 0.064 0.122 0.132 0.186 0.195l136.169 136.17c6.25 6.25 14.438 9.373 22.628 9.373 8.188 0 16.38-3.125 22.627-9.372 12.496-12.496 12.496-32.758 0-45.254z m-412.274-69.466c-79.907 0-155.031-31.118-211.534-87.62-56.503-56.503-87.62-131.627-87.62-211.534s31.117-155.031 87.62-211.534c56.502-56.503 131.626-87.62 211.534-87.62s155.031 31.117 211.534 87.62c56.502 56.502 87.62 131.626 87.62 211.534s-31.118 155.031-87.62 211.534c-56.503 56.502-131.627 87.62-211.534 87.62z"
          fill="#bfbfbf"
          p-id="2694"
          data-spm-anchor-id="a313x.7781069.0.i0"
          class="selected"
        ></path>
      </svg>
      <input class="search" type="text" placeholder="搜索" v-model="keyWord" @search="publishedBooksMessage"/>
    </div>
  </div>
  <div class="jingxuan" v-for="ti in list.records">
    <router-link :to="{ name: 'dlpage', query: { name: ti.name, count: 24 } }">
      <div class="q">
        <div class="title3">{{ ti.name }}</div>
        <div class="gong">共</div>
        <div class="count">25</div>
        <div class="daoti">道题</div>
        <div class="time">考试时长：125分钟</div>
      </div>
    </router-link>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import { useExamStore } from "@/stores/exam";
import { computed, ref } from "vue";
const examStore = useExamStore();
const { getExamLists } = examStore;
const { list } = storeToRefs(examStore);
const keyWord = ref('')
getExamLists();
const router = useRouter();
function fanHui() {
  router.go(-1);
}
const publishedBooksMessage = computed(() => {
  return this.list.filter((item) => {
        return item.name.indexOf(this.keyWord) !== -1;
      })
})
</script>

<style lang="less" scoped>
.top {
  width: 100%;
  height: 60px;
  border-bottom: none;
}
.ret {
  float: left;
  margin-top: 30px;
}
.sch {
  position: absolute;
  width: 90%;
  height: 32px;
  margin-left: 30px;
  margin-top: 30px;
  background-color: rgb(220, 220, 223);
  border-radius: 20px;
  .icon {
    float: left;
    margin: 5px auto auto 10px;
  }
  .search {
    background-color: rgb(220, 220, 223);
    width: 280px;
    height: 30px;
    border: 0;
    outline: none;
    font-size: 16px;

  }
  
}
.jingxuan {
  width: 95%;
  height: 100px;
  background-color: white;
  border-radius: 10px;
  margin-left: 10px;
  margin-top: 10px;
}
.q {
  width: 100%;
  height: 100px;
}
.title3 {
  position: absolute;
  float: left;
  margin: 10px auto auto 20px;
  color: black;
  font-size: 18px;
  font-weight: bold;
}
.gong {
  position: absolute;
  margin: 55px auto auto 20px;
  color: rgb(123, 121, 121);
}
.count {
  position: absolute;
  font-size: 22px;
  margin: 48px auto auto 38px;
  color: rgb(66, 106, 237);
  font-weight: bolder;
}
.daoti {
  position: absolute;
  margin: 55px auto auto 65px;
  color: rgb(123, 121, 121);
}
.time {
  position: absolute;
  color: rgb(123, 121, 121);
  margin: 55px auto auto 200px;
}
</style>
